package leecode

import (
	"sort"
	"strconv"
)

func lexicalOrder(n int) []int {
	var arr []string
	for i := 1; i <= n; i++ {
		arr = append(arr, strconv.Itoa(i))
	}
	sort.Strings(arr)
	var result []int
	for i := 0; i < len(arr); i++ {
		num, _ := strconv.Atoi(arr[i])
		result = append(result, num)
	}
	return result
}
